import request from '@/utils/request'
import qs from 'qs'
//  *********设置-兑付*********

/**   接口名称目录        功能
      listDuifu         列表接口  查询标签
      saveDuifu         新增
      modifyDuifu       编辑  
      getDuifuById      获取编辑该条详情
      removeDuifu       删除标签
**/
// 初始化请求标签列表接口  查询标签
export const listDuifu = (search) => 
    request({
        url: '/op/cash/get_cash_list',
        method: 'get',
        params: {
            pageSize: search.limit,
            keyWord: search.name,
            pageNo:search.currentPage
        }        
    })
//新增
export const saveDuifu = (form) => 
    request({
        url: '/op/cash/create_cash',
        method: 'post',
        data: JSON.stringify({
            name            :form.name,
            description     :form.desc,

            oneTimeReturn   :form.onceReturn,
            returnNum       :form.returnNum,

            oneTimePay      :form.oncePay,
            payDateType     :form.payZhouqi,//付息日期
            payIntervalNum  :form.gapTime,//付息间隔数量
            payIntervalUnit :form.chooseTime,//付息间隔单位

            interestRateType:form.rateType,
            interestBaseType:form.rateBasic
        })
})
//编辑 code！！！！！
export const modifyDuifu = (form) => 
    request({
        url: '/op/cash/modify_cash',
        method: 'post',
        data: JSON.stringify({
            code            :form.code,
            name            :form.name,
            description     :form.desc,

            oneTimeReturn   :form.onceReturn,
            returnNum       :form.returnNum,

            oneTimePay      :form.oncePay,
            payDateType     :form.payZhouqi,//付息日期
            payIntervalNum  :form.gapTime,//付息间隔数量
            payIntervalUnit :form.chooseTime,//付息间隔单位

            interestRateType:form.rateType,
            interestBaseType:form.rateBasic
        })    
})
//获取编辑该条详情
export const getDuifuById = (id) => 
    request({
        url: '/op/cash/get_cash',
        method: 'get',
        params:{
            code:id
        }    
})
//删除标签
export const removeDuifu = (id) =>
    request({
        url: '/op/cash/delete_cash' ,
        method: 'get',
        params:{
            code:id 
        }         
})  
